package com.emperor.customer.logic;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.emperor.core.logic.BizModelBase;
import com.emperor.util.DateFormatter;

public class CustomerModel extends BizModelBase implements Customer {
	
	private SimpleDateFormat sdf = new SimpleDateFormat(DateFormatter.YYYYMMDD);

	private Long id;
	private String name;
	private String code;
	private Long codeid;
	private String phone;
	private String ophone;
	private String hphone;
	private String ic;
	private String gender;
	private String email;
	private String address;
	private String postcode;
	private String state;
	private String country;
	private Double discount;
	private Date birthdate;
	private Date joindate;
	private String joinmethod;
	private Date expirydate;
	private String rcpcode;
	private Double fees;
	private String status;

	public Long getId() {
		return id;
	}

	public void setId(Object id) {
		if (id != null) {
			if (id instanceof Long) {
				this.id = (Long) id;
			} else {
				try {
					this.id = new Long(id.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	public String getName() {
		return name;
	}

	public void setName(Object name) {
		if (name != null) {
			if (name instanceof String) {
				this.name = (String) name;
			} else {
				try {
					this.name = name.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(Object phone) {
		if (phone != null) {
			if (phone instanceof String) {
				this.phone = (String) phone;
			} else {
				try {
					this.phone = phone.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getIc() {
		return ic;
	}

	public void setIc(Object ic) {
		if (ic != null) {
			if (ic instanceof String) {
				this.ic = (String) ic;
			} else {
				try {
					this.ic = ic.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(Object email) {
		if (email != null) {
			if (email instanceof String) {
				this.email = (String) email;
			} else {
				try {
					this.email = email.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(Object address) {
		if (address != null) {
			if (address instanceof String) {
				this.address = (String) address;
			} else {
				try {
					this.address = address.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public Double getDiscount() {
		return discount;
	}

	public void setDiscount(Object discount) {
		if (discount != null) {
			if (discount instanceof Double) {
				this.discount = (Double) discount;
			} else {
				try {
					this.discount = new Double(discount.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	public Date getBirthdate() {
		return birthdate;
	}

	public void setBirthdate(Object birthdate) {
		if (birthdate != null) {
			if (birthdate instanceof Date) {
				this.birthdate = (Date) birthdate;
			} else {
				try {
					this.birthdate = sdf.parse(birthdate.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	public Date getExpirydate() {
		return expirydate;
	}

	public void setExpirydate(Object expirydate) {
		if (expirydate != null) {
			if (expirydate instanceof Date) {
				this.expirydate = (Date) expirydate;
			} else {
				try {
					this.expirydate = sdf.parse(expirydate.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	public Date getJoindate() {
		return joindate;
	}

	public void setJoindate(Object joindate) {
		if (joindate != null) {
			if (joindate instanceof Date) {
				this.joindate = (Date) joindate;
			} else {
				try {
					this.joindate = sdf.parse(joindate.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	public List<String> getFieldNames() {
		List<String> fieldNames = new ArrayList<String>();

		fieldNames.add(Customer.FLD_ID);
		fieldNames.add(Customer.FLD_NAME);
		fieldNames.add(Customer.FLD_CODE);
		fieldNames.add(Customer.FLD_CODEID);
		fieldNames.add(Customer.FLD_IC);
		fieldNames.add(Customer.FLD_GENDER);
		fieldNames.add(Customer.FLD_BIRTHDATE);
		fieldNames.add(Customer.FLD_PHONE);
		fieldNames.add(Customer.FLD_OPHONE);
		fieldNames.add(Customer.FLD_HPHONE);
		fieldNames.add(Customer.FLD_EMAIL);
		fieldNames.add(Customer.FLD_ADDRESS);
		fieldNames.add(Customer.FLD_STATE);
		fieldNames.add(Customer.FLD_POSTCODE);
		fieldNames.add(Customer.FLD_COUNTRY);
		fieldNames.add(Customer.FLD_DISCOUNT);
		fieldNames.add(Customer.FLD_JOINDATE);
		fieldNames.add(Customer.FLD_JOINMETHOD);
		fieldNames.add(Customer.FLD_EXPIRYDATE);
		fieldNames.add(Customer.FLD_RCPCODE);
		fieldNames.add(Customer.FLD_FEES);
		fieldNames.add(Customer.FLD_STATUS);

		fieldNames.add(Customer.FLD_CRTBY);
		fieldNames.add(Customer.FLD_CRTDATE);
		fieldNames.add(Customer.FLD_UPDBY);
		fieldNames.add(Customer.FLD_UPDDATE);

		return fieldNames;
	}

	public String getCode() {
		return code;
	}

	public void setCode(Object code) {
		if (code != null) {
			if (code instanceof String) {
				this.code = (String) code;
			} else {
				try {
					this.code = code.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(Object status) {
		if (status != null) {
			if (status instanceof String) {
				this.status = (String) status;
			} else {
				try {
					this.status = status.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getRcpcode() {
		return rcpcode;
	}

	public void setRcpcode(Object rcpcode) {
		if (rcpcode != null) {
			if (rcpcode instanceof String) {
				this.rcpcode = (String) rcpcode;
			} else {
				try {
					this.rcpcode = rcpcode.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public Double getFees() {
		return fees;
	}

	public void setFees(Object fees) {
		if (fees != null) {
			if (fees instanceof Double) {
				this.fees = (Double) fees;
			} else {
				try {
					this.fees = new Double(fees.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	public String getJoinmethod() {
		return joinmethod;
	}

	public void setJoinmethod(Object joinmethod) {
		if (joinmethod != null) {
			if (joinmethod instanceof String) {
				this.joinmethod = (String) joinmethod;
			} else {
				try {
					this.joinmethod = joinmethod.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public Long getCodeid() {
		return codeid;
	}

	public void setCodeid(Object codeid) {
		if (codeid != null) {
			if (codeid instanceof Long) {
				this.codeid = (Long) codeid;
			} else {
				try {
					this.codeid = new Long(codeid.toString());
				} catch (Exception e) {
				}
			}
		}
	}

	public String getOphone() {
		return ophone;
	}

	public void setOphone(Object ophone) {
		if (ophone != null) {
			if (ophone instanceof String) {
				this.ophone = (String) ophone;
			} else {
				try {
					this.ophone = ophone.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getHphone() {
		return hphone;
	}

	public void setHphone(Object hphone) {
		if (hphone != null) {
			if (hphone instanceof String) {
				this.hphone = (String) hphone;
			} else {
				try {
					this.hphone = hphone.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getGender() {
		return gender;
	}

	public void setGender(Object gender) {
		if (gender != null) {
			if (gender instanceof String) {
				this.gender = (String) gender;
			} else {
				try {
					this.gender = gender.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getPostcode() {
		return postcode;
	}

	public void setPostcode(Object postcode) {
		if (postcode != null) {
			if (postcode instanceof String) {
				this.postcode = (String) postcode;
			} else {
				try {
					this.postcode = postcode.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getState() {
		return state;
	}

	public void setState(Object state) {
		if (state != null) {
			if (state instanceof String) {
				this.state = (String) state;
			} else {
				try {
					this.state = state.toString();
				} catch (Exception e) {
				}
			}
		}
	}

	public String getCountry() {
		return country;
	}

	public void setCountry(Object country) {
		if (country != null) {
			if (country instanceof String) {
				this.country = (String) country;
			} else {
				try {
					this.country = country.toString();
				} catch (Exception e) {
				}
			}
		}
	}

}
